import { rcaNumberFormat,get_month_first,get_date } from './common.js'
import { commonTableOption } from './common.js'
export const startDate = get_month_first(0);
export const endDate = get_date(0);
export const tableOption = {
  ...commonTableOption,
  menu: true,
  editBtn: false,
  delBtn: false,
  column: [
    {
      type: 'date',
      label: '日期',
      prop: 'tradeDate',
      searchValue: [startDate, endDate], 
      valueFormat: 'yyyy-MM-dd',
      searchSpan: 12,
      searchRange: true,
      search: true,
	  width:120,
    }, {
      width:160,
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value,true)
      },
      label: '二维码金额（支付宝）',
      prop: 'qrAlipayMoney'
    }, {
      width:160,
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value,true)
      },
      label: '二维码金额（微信）',
      prop: 'qrWechatMoney'
    }, {
      width:160,
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value,true)
      },
      label: '二维码金额（银联）',
      prop: 'qrBankMoney'
    }, {
      width:140,
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value,true)
      },
      label: 'TVM金额（支付宝）',
      prop: 'tvmAlipayMoney'
    }, {
      width:120,
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value,true)
      },
      label: 'TVM金额（微信）',
      prop: 'tvmWechatMoney'
    }, {
      width:120,
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value,true)
      },
      label: 'TVM金额（建行）',
      prop: 'tvmBankMoney'
    }, {
      type: 'input',
      showSummary: true,
      label: '人脸笔数',
      prop: 'faceAmount'
    }, {
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value,true)
      },
      label: '人脸金额',
      prop: 'faceMoney'
    }, {
      width:170,
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value,true)
      },
      label: '应急及互联互通（支付宝）',
      prop: 'connectivityAlipayMoney'
    }, {
      width:160,
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value,true)
      },
      label: '应急及互联互通（微信）',
      prop: 'connectivityWechatMoney'
    }]
}

const commonConfig = {
  ...commonTableOption,
  page: false,
  refreshBtn: false,
  columnBtn: false,
  showSummary: true,
}

export const tableOption1 = {
  ...commonConfig,
  column: [
    {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate'
    }, {
      type: 'select',
      label: '线路',
      prop: 'lineCode',
      cascaderItem: ['stationCode'],
      props: {
        label: 'name',
        value: 'code'
      },
      dicUrl: '/support/swparamline/dictAll',

    }, {
      type: 'select',
      label: '车站',
      prop: 'stationCode',
      props: {
        label: 'name',
        value: 'code'
      },
      dicFlag: false,
      dicUrl: `/support/swparamstation/dict/{{key}}`,
    }, {
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '微信金额',
      prop: 'wechatMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '支付宝金额',
      prop: 'alipayMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '银联金额',
      prop: 'bankMoney'
    }, {
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '银联自发码金额',
      prop: 'bankZfmMoney'
    }, {
      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}


export const tableOption2 = {
  ...commonConfig,
  column: [
    {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate'
    }, {
      type: 'select',
      label: '线路',
      prop: 'lineCode',
      cascaderItem: ['stationCode'],
      props: {
        label: 'name',
        value: 'code'
      },
      dicUrl: '/support/swparamline/dictAll',
    }, {
      type: 'select',
      label: '车站',
      prop: 'stationCode',
      props: {
        label: 'name',
        value: 'code'
      },
      dicFlag: false,
      dicUrl: `/support/swparamstation/dict/{{key}}`,
    },  {
      label: '支付宝',
      children: [
        {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '购票',
          prop: 'alipaySaleMoney'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '充值',
          prop: 'alipayInvestMoney'
        }
      ]
    },{
      label: '微信',
      children: [
        {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '购票',
          prop: 'wechatSaleMoney'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '充值',
          prop: 'wechatInvestMoney'
        },
      ]
    }, {
      label: '银联',
      children: [
        {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '购票',
          prop: 'bankSaleMoney'
        }, {
          type: 'input',
          showSummary: true,
          precision: 2,
          formatter: (row, value, label, column) => {
            return rcaNumberFormat(value, true)
          },
          label: '充值',
          prop: 'bankInvestMoney'
        }
      ]
    }, {
      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}

export const tableOption3 = {
  ...commonConfig,
  column: [
    {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate'
    }, {
      type: 'select',
      label: '线路',
      prop: 'lineCode',
      cascaderItem: ['stationCode'],
      props: {
        label: 'name',
        value: 'code'
      },
      dicUrl: '/support/swparamline/dictAll',
    }, {
      type: 'select',
      label: '车站',
      prop: 'stationCode',
      props: {
        label: 'name',
        value: 'code'
      },
      dicFlag: false,
      dicUrl: `/support/swparamstation/dict/{{key}}`,
    }, {
      type: 'input',
      showSummary: true,
      label: '建行钱包实收笔数',
      prop: 'amount'
    }, {
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '建行钱包实收金额',
      prop: 'money'
    }, {
      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}
export const tableOption4 = {
  ...commonConfig,
  column: [
    {
      type: 'date',
      label: '交易日期',
      prop: 'tradeDate'
    }, {
      type: 'select',
      label: '线路',
      prop: 'lineCode',
      cascaderItem: ['stationCode'],
      props: {
        label: 'name',
        value: 'code'
      },
      dicUrl: '/support/swparamline/dictAll',
    }, {
      type: 'select',
      label: '车站',
      prop: 'stationCode',
      props: {
        label: 'name',
        value: 'code'
      },
      dicFlag: false,
      dicUrl: `/support/swparamstation/dict/{{key}}`,
    }, {
      type: 'input',
      showSummary: true,
      label: '支付宝实收笔数',
      prop: 'alipayAmount'
    }, {
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '支付宝实收金额',
      prop: 'alipayMoney'
    }, {
      type: 'input',
      showSummary: true,
      label: '微信实收笔数',
      prop: 'wechatAmount'
    }, {
      type: 'input',
      showSummary: true,
      precision: 2,
      formatter: (row, value, label, column) => {
        return rcaNumberFormat(value, true)
      },
      label: '微信实收金额',
      prop: 'wechatMoney'
    }, {
      type: 'input',
      label: '数据提醒',
      prop: 'errMsg',
      slot: true
    }]
}

export const confirmTableConfigMap = {
  '1': {
    option: tableOption1,
    dataFormat: (data) => data
  },
  '2': {
    option: tableOption2,
    dataFormat: (data) => data
  },
  '3': {
    option: tableOption3,
    dataFormat: (data) => data
  },
  '4': {
    option: tableOption4,
    dataFormat: (data) => data
  }
}
